package com.diligreat.servlet; 

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.diligreat.domain.Admin;
import com.diligreat.util.Constants;

/**  
 * @Author Bruce 
 * @Date 2012-10-13
 * @Comments
 */
public class BackEntryServlet extends HttpServlet {
	private static final long serialVersionUID = -4767019166074750556L;

	@Override
	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		Admin op = (Admin) request.getSession().getAttribute(Constants.SESSION_KEY_OP);
		//modify by Bruce 20120308  使用forward跳转
		ServletContext sc = getServletContext();

		String url = "" ;
		if(op == null){
			url = url + "/admin/login.htm";
		}else{
			url = url + "/admin/main.htm";
		}
		System.out.println(url);
		RequestDispatcher dispatcher = sc.getRequestDispatcher(url);
		dispatcher.forward(request, response);
		
	}

	
}
 